<!DOCTYPE html>
<html lang="zh">
<html xmlns:th="http://www.thymeleaf.org">
<!-- themeleaf 引入通用的nav 片段-->
<!-- navbar-static-top  navbar-fixed-top-->
<nav th:fragment="nav(searched)" class="navbar navbar-default navbar-fixed-top" role="navigation" id="top-nav">
    <div class=" container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#vic-navbar-collapse">
                <span class="sr-only">切换导航</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="http://xuqiudong.gitee.io/" target="lcxm-nav">临窗旋墨</a>
        </div>
        <div class="collapse navbar-collapse" id="vic-navbar-collapse">
            <div id="tweather" class="navbar-text"></div>
            <ul class="nav navbar-nav navbar-right-">
                <li th:class="${session.last_request_get_url == '/'} ? 'active':''">
                    <a th:href="@{/}"><i class="fa fa-book" aria-hidden="true"></i> 首页</a>
                </li>
                <li th:class="${session.last_request_get_url == '/categories'} ? 'active':''">
                    <a th:href="@{/categories}">分类</a>
                </li>
                <li th:class="${session.last_request_get_url == '/timeline'} ? 'active':''">
                    <a th:href="@{/timeline}" id="for-nav-search">归档</a>
                </li>
                <li th:class="${session.last_request_get_url == '/poetry'} ? 'active':''">
                    <a th:href="@{/poetry}"><strong class="text-info">诗稿</strong></a>
                </li>
                <li th:class="${session.last_request_get_url == '/comment'} ? 'active':''">
                    <a th:href="@{/comment}" class="active">留言板</a>
                </li>
                <li th:class="${session.last_request_get_url == '/about'} ? 'active':''">
                    <a th:href="@{/about}">关于</a>
                </li>
            </ul>

            <!--登录 或 用户信息-->
            <ul class="nav navbar-nav navbar-right">
                <!--没有登录 则显示登录-->
                <li class="dropdown" th:if="${session.principal == null}">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <span class="glyphicon glyphicon-log-in"></span> 登录
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" style="text-align: center;min-width:100%;">
                        <li><a th:href="@{/third/grant/gitee}"><i class="fa fa-github-square" aria-hidden="true"></i>&nbsp;gitee</a>
                        </li>
                        <li><a th:href="@{/third/grant/github}"><i class="fa fa-github" aria-hidden="true"></i>&nbsp;github</a>
                        </li>
                        <li><a th:href="@{/third/grant/qq}"><img th:src="@{/assets/img/qq-login-blue_76X24.png}"></a>
                        </li>
                        <li><a th:href="@{/third/logout}"><i class="fa fa-sign-out" aria-hidden="true"></i>清除缓存</a></li>
                    </ul>
                </li>

                <li class="dropdown" th:if="${session.principal}">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        [[${session.principal.nickname}]]
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" style="text-align: center;min-width:100%;">
                        <li><a th:href="@{/third/logout}"><i class="fa fa-sign-out" aria-hidden="true"></i>退出</a></li>
                    </ul>
                </li>
            </ul>


            <form th:if="${searched}" class="navbar-form pull-right form-inline olny-hide" role="search"
                  id="nav-search">
                <div class="input-group">
                    <input type="text" class="form-control" placeholder="search">
                    <div class="input-group-btn">
                        <button type="button" class="btn btn-default" tabindex="-1">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</nav>